package uk.ac.tees.aetoolkit;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;

/**
 * Memo application used to store memos and display them in a widget.
 * 
 * @author Sohail Rahman, Mark Williamson, Robert Sheffield
 * 
 */
public class Memo extends Activity {
	//string to store memo.
	private String memo1 = "";
	//sets the context to this.
	private Context ctx = this;
	//sets the edittext.
	private EditText memoText;

	/**
	 * oncreate method for class.
	 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_memo);
		memoText = (EditText) findViewById(R.id.editText1);
		//sets add memo button.
		Button addMemoBtn = (Button) findViewById(R.id.addMemoBtn);
		//sets help button.
		Button memoHelp = (Button) findViewById(R.id.button3);
		//sets onclicklistener to button which shows a dialog when pressed with help to use the memo app.
		memoHelp.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				AlertDialog alertDialog;
				AlertDialog.Builder alertDialog2 = new AlertDialog.Builder(
						Memo.this);
				alertDialog2.setTitle("Help");
				alertDialog2
						.setMessage("To use the memo application enter your memo and press enter memo, if you would like to return to the homescreen press home.");
				alertDialog2.show();

			}
		});
		
		addMemoBtn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				memo1 = memoText.getText().toString();
				Toast.makeText(ctx, memo1, Toast.LENGTH_SHORT).show();
			}
		});
	}
}
